package com.cy.cqb.dockerjava.service;

import com.github.dockerjava.api.DockerClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class StartDockerContainerWithCode {

    @Autowired
    private DockerClientService dockerClientService;

    /**
     * 启动已存在的容器
     * @return
     */
    public String startDockerContainer() {
        DockerClient dockerClient = dockerClientService.connectDocker();
        dockerClientService.startContainer(dockerClient, "0af1e1b9e7c1");
        //dockerClientService.startContainer(dockerClient, getDockerContainerId);
        return "start success！";
    }

}
